Table Sound
Functions for sound management.
Functions
PlayAudioTrack(name, type) | Play an audio track |
SetAmbientTrack(name, fromStart) | Set and play an ambient track |
StopAudioTracks() | Stop any audio tracks currently playing |
StopAudioTrack(type) | Stop audio track that is currently playing |
GetAudioTrackLoudness(type) | Get current loudness level for specified track type |
PlaySound(sound[, position]) | Play sound effect |
StopSound(sound) | Stop sound effect |
IsSoundPlaying(Sound) | Check if the sound effect is playing |
IsAudioTrackPlaying(Track) | Check if the audio track is playing |
GetCurrentSubtitle() | Get current subtitle string for a voice track currently playing. |
Functions
- PlayAudioTrack(name, type)
-
Play an audio track
Parameters:
- name string of track (without file extension) to play
- type SoundTrackType of the audio track to play
- SetAmbientTrack(name, fromStart)
-
Set and play an ambient track
Parameters:
- name string of track (without file extension) to play
- fromStart bool specifies whether ambient track should play from the start, or crossfade at a random position
- StopAudioTracks()
- Stop any audio tracks currently playing
- StopAudioTrack(type)
-
Stop audio track that is currently playing
Parameters:
- type SoundTrackType of the audio track
- GetAudioTrackLoudness(type)
-
Get current loudness level for specified track type
Parameters:
- type SoundTrackType of the audio track
Returns:
-
float
current loudness of a specified audio track
- PlaySound(sound[, position])
-
Play sound effect
Parameters:
- sound int ID to play. Corresponds to the value in the sound XML file or Tomb Editor's "Sound Infos" window.
- position Vec3 The 3D position of the sound, i.e. where the sound "comes from". If not given, the sound will not be positional. (optional)
- StopSound(sound)
-
Stop sound effect
Parameters:
- sound int ID to play. Corresponds to the value in the sound XML file or Tomb Editor's "Sound Infos" window.
- IsSoundPlaying(Sound)
-
Check if the sound effect is playing
Parameters:
- Sound int ID to check. Corresponds to the value in the sound XML file or Tomb Editor's "Sound Infos" window.
- IsAudioTrackPlaying(Track)
-
Check if the audio track is playing
Parameters:
- Track string filename to check. Should be without extension and without full directory path.
- GetCurrentSubtitle()
-
Get current subtitle string for a voice track currently playing.
Subtitle file must be in .srt format, have same filename as voice track, and be placed in same directory as voice track.
Returns nil if no voice track is playing or no subtitle present.
Returns:
-
string
current subtitle string